package com.cty;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class regExpression05 {
    public static void main(String[] args) {
        //正则表达式分组时加个组名
        String content ="ajcjav12366";
//        String regStr = "(\\d\\d)(\\d\\d)";//表示前两个字母一组，后两个字母一组
        String regStr ="(?<juejiang01>\\d\\d)(?<juejiang02>\\d\\d)";//问号后面的尖括号里面的是本组的名字
        Pattern compile = Pattern.compile(regStr);
        Matcher matcher = compile.matcher(content);
        while (matcher.find()) {
            System.out.println("提取到：" + matcher.group(0)+","+matcher.group("juejiang01")+ ","+matcher.group("juejiang02"));
        }
    }
}
